<template>
  <div class="index">
<!--
    <el-form :inline="true" label-width="68px">
      <el-form-item label="代理城市" prop="city">
        <el-input v-model="city" placeholder="请输入城市(例:北京市)" clearable style="width: 240px" @keyup.enter="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
-->


    <div>
      <div class="line_title">
        总收支
      </div>
      <div class="content">
        <el-row :gutter="20">
          <el-col :span="6">
            <div class="grid-content bg_red">
              <div class="price">{{topData.allIncome||0}}</div>
              <div class="text">收入(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_red">
              <div class="price">{{report.allWithdrawal||0}}</div>
              <div class="text">提现(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_red">
              <div class="price">{{topData.allSendIncome||0}}</div>
              <div class="text">发布广告收入(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_red">
              <div class="price">{{topData.allVipIncome||0}}</div>
              <div class="text">会员收入(元)</div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div class="line_title m_t_20">
        今日收支
      </div>
      <div class="content">
        <el-row :gutter="20">
          <el-col :span="6">
            <div class="grid-content bg_orange">
              <div class="price">{{topData.income||0}}</div>
              <div class="text">收入(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_orange">
              <div class="price">{{report.withdrawal||0}}</div>
              <div class="text">提现(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_orange">
              <div class="price">{{topData.sendIncome||0}}</div>
              <div class="text">发布广告收入(元)</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_orange">
              <div class="price">{{topData.vipIncome||0}}</div>
              <div class="text">会员收入(元)</div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div class="line_title m_t_20">
        总新增用户数量
      </div>
      <div class="content">
        <el-row :gutter="20">
          <el-col :span="6">
            <div class="grid-content bg_green">
              <div class="price">{{report.allAddUser||0}}</div>
              <div class="text">总用户</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_green">
              <div class="price">{{report.allUser||0}}</div>
              <div class="text">普通用户</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_green">
              <div class="price">{{report.allWeekVip||0}}</div>
              <div class="text">周会员</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_green">
              <div class="price">{{report.allMonthVip||0}}</div>
              <div class="text">月会员</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_green">
              <div class="price">{{report.allYearVip||0}}</div>
              <div class="text">年会员</div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    <div>
      <div class="line_title m_t_20">
        今日新增用户数量
      </div>
      <div class="content">
        <el-row :gutter="10">
          <el-col :span="6">
            <div class="grid-content bg_blue">
              <div class="price">{{report.addUser||0}}</div>
              <div class="text">总用户</div>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg_blue">
              <div class="price">{{report.user||0}}</div>
              <div class="text">普通用户</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_blue">
              <div class="price">{{report.weekVip||0}}</div>
              <div class="text">周会员</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_blue">
              <div class="price">{{report.monthVip||0}}</div>
              <div class="text">月会员</div>
            </div>
          </el-col>
          <el-col :span="4">
            <div class="grid-content bg_blue">
              <div class="price">{{report.yearVip||0}}</div>
              <div class="text">年会员</div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script setup name="Index" lang="ts">
import { getCwTj,gettopUp } from '@/api/index';

const report = ref<any>({});
const topData = ref<any>({});
const city = ref('')

const getReport = async () => {
  const res = await getCwTj();
  report.value = res.data;
};
const getTop = async () => {
  const res = await gettopUp();
  topData.value = res.data;
};
const handleQuery = (value) => {
  console.log(value)
}
const resetQuery = () => {
  city.value = '';
  handleQuery(value);
}


getReport();
getTop();
</script>

<style scoped lang="scss">
.m_t_20{
  margin-top: 20px;
}
.bg_red{
  background-color: #a96d6d;
}
.bg_green{
  background-color: #6f9764;
}
.bg_orange{
  background-color: #d9a454;
}
.bg_blue{
  background-color: #6494af;
}
.index {
  padding: 30px;
  .line_title{
    font-size: 20px;
    font-weight: 700;
    position: relative;
    left: 15px;
  }
  .line_title::before{
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 20px;
    border-radius: 5px;
    background-color: #27AC2F;
  }
  .two {
    margin-top: 50px;
    .dateChoose {
      display: flex;
      justify-content: flex-end;
      margin-top: 20px;
    }
    .two-title {
      font-size: 20px;
      font-weight: 700;
      display: flex;
      justify-content: space-between;
    }
  }
  .content {
    margin-top: 20px;
    .bg-purple-light {
    }
    .grid-content {
      color: #ffffff;
      border-radius: 4px;
      padding: 30px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    .price {
      font-size: 26px;
      font-weight: 700;
      margin-bottom: 10px;
    }
  }
}
</style>
